package com.cf.r1027_e;

import java.io.*;

public class c {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StreamTokenizer in = new StreamTokenizer(br);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        in.nextToken(); int T = (int) in.nval;
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    // 贪心
    static void solve() throws IOException {
        in.nextToken(); int n = (int) in.nval;
        int[] a = new int[n];
        int ans = 1;
        int count = 1;
        for (int i = 0; i < n; i++) {
            in.nextToken(); a[i] = (int) in.nval;
            if (i > 0 && a[i] > a[i - 1] + 1) ans++;
            if (i > 0 && a[i] != a[i - 1]) count++;
        }
        int[] b = new int[count];
        for (int i = 0, j = 0, pre = -1; i < n; i++) {
            if (a[i] != pre) {
                b[j++] = a[i];
            }
            pre = a[i];
        }

        for (int i = 1; i < count - 1; i++) {
            if (b[i] == b[i - 1] + 1 && b[i] == b[i + 1] - 1) {
                ans++;
                i++;
            }
        }
        out.println(ans);
    }
}
